<template>
	<view class="xieyi">
		<view class="title">
			<u-icon name="arrow-left" size="24" @click="back"></u-icon>
			<text style="margin-left: 24rpx;">{{title}}</text>
		</view>
		<view class="xieyibox">
			<rich-text type="text" :nodes="content"></rich-text>
		</view>
		
	</view>
</template>

<script>
	import{config}from "@/api/api.js"
	var graceRichText = require("../../static/richText.js");
	export default{
		data(){
			return{
				title:"",
				content:"",
				type:"",
			}
		},
		onLoad(options) {
			console.log("options",options)
			this.type = options.type
			if(options.type =='zhuce'){
				this.title = '注册协议'
			}else{
				this.title = '隐私协议'
				
			}
			this.configs()
		},
		methods:{
			async configs(){
				let res = await config()
				if(res.code ==1){
					console.log("xieyi",res)
					if(this.type =='zhuce'){
						this.content = graceRichText.format(res.data.register_rule)
					}else{
						this.content = graceRichText.format(res.data.privacy)
						
					}
					
				}
			},
			back(){
				uni.redirectTo({
					url:'/pages/index/index'
				})
			}
			
		}
	}
</script>

<style scoped lang="scss">
	.xieyi{
		min-height: 100%;
		.title {
			width: 100%;
			height: 176rpx;
			padding-top: 110rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			font-size: 32rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #333333;
			line-height: 38rpx;
			padding-left: 34rpx;
			box-sizing: border-box;
		
		}
		.xieyibox{
			margin-top: 42rpx;
			padding: 30rpx;
		}
	}
</style>